<template>
  <system-index @to-main-page="toMainPage">
    <goods-bargain-detail :has-back="hasBack" @to-page="toPage"></goods-bargain-detail>
  </system-index>
</template>

<script>
  import SystemIndex from 'views/systemIndex';
  import GoodsBargainDetail from 'views/goodsBargainDetail/';

  import mpMixins from '../mpMixins';

  export default {
    mixins: [mpMixins],

    data() {
      let pages = getCurrentPages();
      return {
        hasBack: pages.length > 1
      };
    },

    created() {
      window.onShareAppMessage = function () {
        let href = window.location.href;
        let origin = window.location.origin;
        let url = href.substring(origin.length);
        return {
          path: url
        }
      };
    },

    components: {
      SystemIndex,
      GoodsBargainDetail
    }
  };

</script>
